package com.blueocean_health.care.management.controller;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.blueocean_health.care.management.common.LocalManager;
import com.blueocean_health.care.management.domain.base.Hospital;
import com.blueocean_health.care.management.domain.base.SysResult;
import com.blueocean_health.care.management.domain.base.User;
import com.blueocean_health.care.management.domain.dto.PullDownDto;
import com.blueocean_health.care.management.em.LocalManagerType;
import com.blueocean_health.care.management.exception.OrderException;
import com.blueocean_health.care.management.service.HospitalService;

/**
 * 医院模块 接口 2017年8月22日17:09:00
 * @author wuyanli
 *
 */

@RestController
@RequestMapping("web/Hospital")
public class HospitalController {
	
	@Resource
	private HospitalService hospitalService;
	
	/**
	 * 获取所有医院信息
	 * @return
	 */
	@RequestMapping("getAllHospital")
	public SysResult  getAllHospital(){
		List<PullDownDto> allHospital = hospitalService.getAllHospital();
		return SysResult.ok(0, "success", allHospital);
	}
	
	/**
	 * 获取所有医院信息
	 * @return
	 * @throws OrderException 
	 */
	@PostMapping("getNewAllHospital")
	public SysResult  getNewAllHospital() throws OrderException{
		// 获得当前登录用户信息
		User user = LocalManager.getVal(LocalManagerType.USER_WEB);
		List<PullDownDto> allHospital = hospitalService.getNewAllHospital(user.getHospitalId());
		return SysResult.ok(0, "success", allHospital);
	}
	
	/**
	 * 根据医院Id获取医院信息
	 * @param hospitalId
	 * @return
	 */
	@RequestMapping("getHospitalInfoById")
	public SysResult getHospitalInfo(@RequestBody Map<String,String> map){
		Hospital hospitalInfo = hospitalService.getHospitalInfo(map.get("hospitalId"));
		return SysResult.ok(0, "success", hospitalInfo);
	}
	/**
	 * 修改医院资费信息
	 * @param hospitalId
	 * @return
	 */
	
}
